package com.ruoyi.system.controller;

import java.util.List;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.vo.SelectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WmsSuppliers;
import com.ruoyi.system.service.IWmsSuppliersService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 供应商信息Controller
 *
 * @author ruoyi
 * @date 2025-06-12
 */
@RestController
@RequestMapping("/system/wmsSuppliers")
public class WmsSuppliersController extends BaseController
{
    @Autowired
    private IWmsSuppliersService wmsSuppliersService;

    /**
     * 查询供应商信息列表
     */
    @SaCheckPermission("system:wmsSuppliers:list")
    @GetMapping("/list")
    public TableDataInfo<WmsSuppliers> list(WmsSuppliers wmsSuppliers, PageQuery pageQuery)
    {
        return wmsSuppliersService.selectWmsSuppliersList(wmsSuppliers,pageQuery);
    }

    /**
     * 导出供应商信息列表
     */
    /*@SaCheckPermission("system:wmsSuppliers:export")
    @Log(title = "供应商信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsSuppliers wmsSuppliers)
    {
        List<WmsSuppliers> list = wmsSuppliersService.selectWmsSuppliersList(wmsSuppliers);
        ExcelUtil<WmsSuppliers> util = new ExcelUtil<WmsSuppliers>(WmsSuppliers.class);
        util.exportExcel(response, list, "供应商信息数据");
    }*/

    /**
     * 获取供应商信息详细信息
     */
    @SaCheckPermission("system:wmsSuppliers:query")
    @GetMapping(value = "/{id}")
    public R<WmsSuppliers> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(wmsSuppliersService.selectWmsSuppliersById(id));
    }

    /**
     * 新增供应商信息
     */
    @SaCheckPermission("system:wmsSuppliers:add")
    @Log(title = "供应商信息", businessType = BusinessType.INSERT)
    @PostMapping
    public R<Void> add(@RequestBody WmsSuppliers wmsSuppliers)
    {
        return toAjax(wmsSuppliersService.insertWmsSuppliers(wmsSuppliers));
    }

    /**
     * 修改供应商信息
     */
    @SaCheckPermission("system:wmsSuppliers:edit")
    @Log(title = "供应商信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<Void> edit(@RequestBody WmsSuppliers wmsSuppliers)
    {
        return toAjax(wmsSuppliersService.updateWmsSuppliers(wmsSuppliers));
    }

    /**
     * 删除供应商信息
     */
    @SaCheckPermission("system:wmsSuppliers:remove")
    @Log(title = "供应商信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R<Void> remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsSuppliersService.deleteWmsSuppliersByIds(ids));
    }

    /**
     * 查询商品品牌列表
     */
    @SaCheckPermission("system:wmsSuppliers:list")
    @GetMapping("/getSupplierSelect")
    public R<List<SelectVo>> getSupplierSelect(){
        return R.ok(wmsSuppliersService.getSupplierSelect());
    }
}
